package com.mida.dms.knw.api;

import com.mida.dms.knw.entity.DtUseSpace;
import com.mida.dms.knw.entity.vo.DtUseSpaceVo;
import com.mida.dms.knw.vo.DtUseSpacePageVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
@DependsOn("loadFromDatabasePropertyConfig")
//@FeignClient(name = "DtUseSpaceApi", url = "${dms.knw.feign.url}")
@FeignClient(name = "DtUseSpaceApi", url = "dms.knw.feign.url")
public interface DtUseSpaceApi {
    /**
     * 1、添加授权空间
     *
     * @param dtUseSpaceVo
     * @return
     */
    @PostMapping(value = "dtUseSpace/add",consumes = {"application/json"})
    public ActionResult add(@RequestBody DtUseSpaceVo dtUseSpaceVo);

    /**
     * 2、更新授权空间
     *
     * @param dtUseSpaceVo
     * @return
     */
    @PostMapping(value = "dtUseSpace/update",consumes = {"application/json"})
    public ActionResult update(@RequestBody DtUseSpaceVo dtUseSpaceVo);

    /**
     * 3、删除授权空间
     *
     * @param useSpaceSoid 授权空间soid
     * @return null
     */
    @GetMapping(value = "dtUseSpace/delete")
    public ActionResult delete(@RequestParam(value = "useSpaceSoid") long useSpaceSoid);

    /**
     * 4、获取单个授权空间
     *
     * @param useSpaceSoid 授权空间soid
     * @return
     */
    @GetMapping("dtUseSpace/get")
    public ListResult<DtUseSpaceVo> get(@RequestParam(value = "useSpaceSoid") long useSpaceSoid);

    /**
     * 5、分页查询授权空间
     * @param vo
     * @return
     */
    @ApiOperation(value = "分页查询授权空间", notes = "分页查询授权空间")
    @PostMapping(value = "dtUseSpace/findPage",produces = { "application/json;charset=UTF-8" })
    public ListResult<PageResultVo<DtUseSpaceVo>> findPage(@RequestBody DtUseSpacePageVo vo);

    /**
     * 6、授权空间名称重复性校验
     */
    @GetMapping(value = "dtUseSpace/checkName")
    public ActionResult checkName(@RequestParam(value = "name", required = true) String name,
                                  @RequestParam(value = "useSpaceSoid", required = false) Long useSpaceSoid);

    /**
     * 7、更改授权空间状态
     *
     * @param useSpaceSoid 授权空间soid
     * @param status       状态soid
     * @return
     */
    @GetMapping("dtUseSpace/updateStatus")
    public ActionResult updateStatus(@RequestParam(value = "status", required = true) Long status,
                                     @RequestParam(value = "useSpaceSoid", required = false) Long useSpaceSoid);

    /**
     * 8、授权空间下拉(查询所有授权空间)
     * @return
     */
    @GetMapping("dtUseSpace/findAll")
    public ListResult<List<DtUseSpace>> findAll();
}
